package com.legal.service.practice.impl.view.impl;

import com.legal.domain.po.practice_view.PracticeRecordsListView;
import com.legal.mapper.practice.view.PracticeRecordsListViewMapper;
import com.legal.service.practice.impl.view.IPracticeRecordsListViewService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * VIEW 服务实现类
 * </p>
 *
 * @author xiaopeng
 * @since 2025-06-27
 */
@Service
public class PracticeRecordsListViewServiceImpl extends ServiceImpl<PracticeRecordsListViewMapper, PracticeRecordsListView> implements IPracticeRecordsListViewService {

    /**
     * 根据用户编号查询刷题记录
     *
     * @param userNo
     * @return
     */
    @Override
    public List<PracticeRecordsListView> getHistoryListByUserNo(String userNo) {

        return lambdaQuery()
                .eq(PracticeRecordsListView::getUserNo, userNo)
                .list();
    }

    /**
     * 根据记录编号查询对应的刷题记录主信息
     * @param recordNo
     * @return
     */
    @Override
    public PracticeRecordsListView getPracticeRecordByRecordNo(String recordNo) {
        return  lambdaQuery()
                .eq(PracticeRecordsListView::getRecordNo, recordNo)
                .one();
    }
}
